Repository navigation
[Feat]: age-to-length conversion plot - #512
MOshima-PIFSC wants to merge 18 commits into
Conversation
Code Metrics Report
Code coverage of files in pull request scope (77.9%, patch 30.0%)
Reported by octocov |
|
Note for @sbreitbart-NOAA : we incorporated a new approach that looks over and describes trends of each facet (up to 2 facets) that is replacing a placeholder in the alt text. This was because the way these plots get described is easy to automate comparatively to other trends you see on other plots like |
|
@MOshima-PIFSC and @Schiano-NOAA, I mentioned yesterday that the one SS3 production assessment that I knew of which has more than 2 growth morphs is the Gulf of Alaska Rex Sole assessment developed by @careymcgilliard. The plot below is the result of running the following code to read the input files, run the model, and make the plot. The alt-text looks reasonable to me:
For others watching this, we discussed in our meeting yesterday that repeating the summary of the pattern in each panel for more than 2 panels in this plot could make for really long alt-text not necessarily make better alt-text and would only apply to a tiny fraction of models. # define a directory (change as needed)
goa_rex_dir <- file.path(getwd(), "goa_rex")
# load input files from github
goa_rex_inputs <- r4ss::SS_read("https://raw.githubusercontent.com/noaa-afsc/goa_rex/refs/heads/main/runs/2025_models/2021_accepted_model_inputs/")
# save files to local directory
r4ss::SS_write(goa_rex_inputs, dir = goa_rex_dir)
# get SS3 exe if needed
r4ss::get_ss3_exe(dir = goa_rex_dir)
# run model without Hessian (no uncertainty needed for growth plot)
r4ss::run(goa_rex_dir, extras = "-nohess")
# load model output
goa_rex_out <- r4ss::SS_output(goa_rex_dir)
# convert output to stockplotr standard format
goa_rex_std <- stockplotr::convert_output(goa_rex_out)
stockplotr::plot_age_to_length_conversion(goa_rex_std) +
ggplot2::theme_minimal() # works better with Ian's github dark mode setting
ggsave(file.path(goa_rex_dir, "age_to_length.png"), width = 7, height = 7)
|
|
Thanks @iantaylor-NOAA for testing that! Looks like its working how we wanted it to :) |
sbreitbart-NOAA
left a comment
There was a problem hiding this comment.
The plots look great! I'm able to specify different arguments for ss3_simple and get some awesome-looking plots. I get the same error msg for the other built-in datasets (pollock, example_data, vermilion_snapper). This may be addressed if I convert these datasets myself before testing, but I think an existing bug in convert_output() (which may be addressed by Eric's existing PR) prevents this, so I'm unable to test. Otherwise, I had some relatively minor comments. And the captions/alt text setup seems to work well too!
Error in filter_data() at stockplotr/R/plot_age_to_length.R:66:3:
! age_to_length_conversion not found.
Run rlang::last_trace() to see where the error occurred.
I added a fix for BAM, but there is no age length for BAM in the example data set. I might be able to grab one from the BAMextras package and replace the current example so it exists. I am working on getting this working for Rceattle as well, so it currently should only work for SS3 r4ss object. I was not planning to add it for the report.sso file. I think FIMS should have it since I think they merged in the PR with age length that originally had this plot but we don't have example data in the package for them (just something to note). Lastly, I will add back in the example_data. |
3011b7b to
adae78c
Compare
adae78c to
de6a717
Compare
…riggered by e218d27 fix fixtures and adjust argument name from deprecation warning) [skip ci]
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

What is the feature?
How have you implemented the solution?
plot_age_to_length()andplot_density()Does the PR impact any other area of the project, maybe another repo?
I'm not sure if this is fully ready to be merged in so I am making it a draft for now.
PR contribution checklist
Thank you for contributing to stockplotr! Please check the boxes below to confirm this pull request (PR) is ready for review. Edit this PR description to add the release indicator and any explanations.